package com.siwei.eqi.controller;

import com.github.pagehelper.PageInfo;
import com.siwei.eqi.pojo.ResultBean;
import com.siwei.eqi.pojo.dto.DeliveryTaskBatchDTO;
import com.siwei.eqi.pojo.entity.DeliveryTaskBatch;
import com.siwei.eqi.pojo.vo.DeliveryTaskBatchInfoVO;
import com.siwei.eqi.pojo.vo.DeliveryTaskBatchVO;
import com.siwei.eqi.service.IDeliveryTaskBatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 汇交批次表 前端控制器
 * </p>
 *
 * @author hzl
 * @since 2025-04-02
 */
@RestController
@RequestMapping("/deliveryTaskBatch")
public class DeliveryTaskBatchController {

    @Autowired
    private IDeliveryTaskBatchService taskBatchService;

    /**
     * 批次-列表查询
     * @param taskId
     * @return
     */
    @GetMapping("/list")
    public ResultBean<List<DeliveryTaskBatchVO>> queryList(@RequestParam(required = true) String taskId) {
        return ResultBean.success(taskBatchService.queryList(taskId));
    }

    /**
     * 批次-新增
     * @param dto
     * @return
     */
    @PostMapping("/save")
    public ResultBean queryList(@RequestBody DeliveryTaskBatchDTO dto) {
        return ResultBean.success(taskBatchService.save(dto));
    }

    /**
     * 批次-详情
     * @param id
     * @return
     */
    @GetMapping("/detail")
    public ResultBean<DeliveryTaskBatchInfoVO> detail(@RequestParam(required = true) String id) {
        return ResultBean.success(taskBatchService.detail(id));
    }

    /**
     * 批次-通过
     * @param id
     * @return
     */
    @GetMapping("/pass")
    public ResultBean pass(@RequestParam(required = true) String id) {
        return ResultBean.success(taskBatchService.pass(id));
    }

}
